<template>
  <div class="alphabet" v-if="cityInfo">
    <div class="scroll_wrap citylist">
      <div class="hot_wrap">
        <div class="title">热门城市</div>
        <ul class="hot_city">
          <li v-for="(item,indexs) in cityInfo.hotCities" :key="indexs">{{item.name}}</li>
        </ul>
      </div>
      <!-- 所有城市 -->
      <div class="city_wrap">
        <div class="city_content citylist" v-for="(item,index) in keys" :key="index">
          <div class="title">{{item}}</div>
          <!-- 根据字母key展示城市名 -->
          <ul>
            <li v-for="(city,index) in cityInfo[item]" :key="index">{{city.name}}</li>
          </ul>
        </div>
      </div>
    </div>
    <div class="area_keys">
      <ul>
        <li @click="selectKey(0)">#</li>
        <li @click="selectKey(index+1)" v-for="(item,index) in keys" :key="index">{{item}}</li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  name: "alphabet",
  props: {
    cityInfo: Object,
    keys: Array
  },
  methods: {
    selectKey(index) {
      console.log(index);
    }
  },
  data() {
    return {};
  }
};
</script>

<style  scoped>
.title {
  color: rgb(155, 16, 16);
  font-size: 18px;
}
.area_keys {
  position: fixed;
  right: 0;
  top: 25%;
  color: #aaa;
  font-size: 12px;
  text-align: center;
  padding: 0 5px;
}
</style>